<template>
  <div>
    <vue-json-editor v-model="json" :show-btns="true" @json-change="onJsonChange"></vue-json-editor>
  </div>
</template>

<script>
import vueJsonEditor from 'vue-json-editor'
import { apiAuthKey } from '@/api/SiteApiTest'
export default {
  name: 'AuthKey',
  components: {
    vueJsonEditor
  },
  data () {
    return {
      formAuthKey: {
        site_code: '',
        secret_key: ''
      },
      requestParam: '',
      responseParam: '',
      spendTime: 0,
      rsShow: false,
      isLoading: false,
      json: {
        foo: 'bar'
      }
    }
  },
  methods: {
    handleApiAuthKey () {
      // this.requestParam = this.param.trim().str.replace(/\s*/g, '')
      // this.requestParam = JSON.stringify(this.param.trim().replace('\n', ''))
      apiAuthKey(this.param).then(res => {
        this.responseParam = JSON.parse(res)
        this.rsShow = true
      })
    },
    onJsonChange (value) {
      console.log('value:', value)
    }
  },
  mounted () {
  }
}
</script>

<style lang="less">
@import "./AuthKey";
</style>
